const App = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    isLogin: false,
    teamId:0,
    list:[],
  },
  //控制左上角自带返回键的链接
  onUnload: function () {
    wx.reLaunch({
      url: '/pages/user/index'
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {},
  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    wx.hideHomeButton();
    let that = this;
    that.setData({
      isLogin: App.checkIsLogin(),
    });
    if (that.data.isLogin) {
      //获取服务队
      that.setData({
        teamId: App.checkTeam()
      });
      // 获取数据
      that.getDataList();
    }
  },

   //获取数据列表
   getDataList(){
    let that = this;
    App._get('article/aboutuscate', {}, result => {
      that.setData({
        list: result.data.list,
      }); 
    });
  },
  // 删除
  newsDel(e){
    let that = this
    let category_id = e.currentTarget.dataset.id;
    App._post_form('article/aboutus_del', {category_id}, result => {
      //成功提示
      App.showSuccess(result.msg, function() {
        that.getDataList();
      });
    });
  },
  // 详情页跳转
  newsDetail(e){
    let nid = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: './edit/index?nid=' + nid,
    })
  },

})